﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using System.ComponentModel;

namespace CITWebsite.Models
{
    [MetadataType(typeof(MediaMetadata))]
    public partial class MEDIA
    {
        public MEDIA(int id, string mediaid, string title, string intro, string content, DateTime datecreate, bool ispublish, bool istop, bool isdelete, string typemedianame, string usercreate)
        {
            this._ID = id;
            this._MediaID = mediaid;
            this._Title = title;
            this._Intro = intro;
            this._Content = content;
            this._DateCreate = datecreate;
            this._IsPublish = ispublish;
            this._IsTop = istop;
            this._IsDelete = isdelete;
            this._TypeMediaName = typemedianame;
            this._UserCreate = usercreate;
        }

        class MediaMetadata
        {
            [HiddenInput]
            public int ID { get; set; }

            [HiddenInput]
            [DataType(DataType.Text)]
            [DisplayName("MediaID")]
            [StringLength(250, ErrorMessage = "MediaID cannot have more than 250 characters")]
            public string MediaID { get; set; }

            [DataType(DataType.Text)]
            [DisplayName("Tên")]
            [Required(ErrorMessage = "Tên không thể rỗng")]
            [StringLength(200, ErrorMessage = "Tên cannot have more than 200 characters")]
            public string Title { get; set; }

            [DataType(DataType.Text)]
            [DisplayName("Giới thiệu")]
            [StringLength(500, ErrorMessage = "Intro cannot have more than 500 characters")]
            public string Intro { get; set; }

            [DataType(DataType.Text)]
            [DisplayName("Nội dung")]
            public string Content { get; set; }

            [DataType(DataType.DateTime)]
            [DisplayName("DateCreate")]
            public DateTime DateCreate { get; set; }

            [DisplayName("Xuất bản")]
            public bool IsPublish { get; set; }

            [DisplayName("Đưa vào danh sách top")]
            public bool IsTop { get; set; }

            [DisplayName("IsDelete")]
            public bool IsDelete { get; set; }

            [DataType(DataType.Text)]
            [DisplayName("TypeMediaName")]
            [StringLength(30, ErrorMessage = "TypeMediaName cannot have more than 30 characters")]
            public string TypeMediaName { get; set; }

            [DataType(DataType.Text)]
            [DisplayName("UserCreate")]
            [StringLength(20, ErrorMessage = "UserCreate cannot have more than 20 characters")]
            public bool UserCreate { get; set; }
        }
    }
}